home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 5.8 KB | 256 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWStdDef.h
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWSTDDEF_H
- #define FWSTDDEF_H
-
- #ifndef FWENVDEF_H
- #include "FWEnvDef.h"
- #endif
-
- #ifndef FWERRORS_H
- #include "FWErrors.h"
- #endif
-
- #if defined(FW_BUILD_MAC) & !defined(__TYPES__)
- #include <Types.h>
- #endif
-
- #if defined(FW_BUILD_MAC) & !defined(__FRAGRSRC__)
- #include "FragRsrc.h"
- #endif
-
- #if defined(FW_BUILD_MAC) & !defined(__LOWMEM__)
- #include <LowMem.h>
- #endif
-
- #if defined FW_BUILD_MAC && !defined __FILES__
- #include <Files.h>
- #endif
-
- #ifdef FW_BUILD_WIN
- #include <windows.h>
- #endif
-
- FW_EXTERN_C_BEGIN
-
- /*========================================================================================
- / Build system macro definitions
- /========================================================================================*/
-
- /*----------------------------------------------------------------------------------------
- /
- / The macro SL_API is used to define more effecient calling convention for the Windows
- / version of the ODF shared library (SL). It should be used like this:
- /
- / void* SL_APL FW_OhWellWhateverNevermind(long l, short s);
- /
- /----------------------------------------------------------------------------------------*/
-
- #ifdef FW_BUILD_MAC
- #define SL_API
- #endif
-
- #ifdef FW_BUILD_WIN
- #define SL_API __stdcall
- #endif
-
- #ifndef SOMCHKEXCEPT
- #define SOMCHKEXCEPT You_forgot_to_include_FWODExce_has_the_first_header_in your__cpp
- #endif
-
- /*========================================================================================
- // Define OpenDoc version number so we can use appropriate interface
- /========================================================================================*/
-
- #ifndef FW_OPENDOC_VERSION
-
- #define FW_OPENDOC_DR1 1
- #define FW_OPENDOC_DR2 2
- #define FW_OPENDOC_DR3 3
- #define FW_OPENDOC_DR4 4
- #define FW_OPENDOC_100 FW_OPENDOC_DR4
- #define FW_OPENDOC_101 5
-
- #ifdef FW_BUILD_MAC
- #define FW_OPENDOC_VERSION FW_OPENDOC_DR4
- #endif
-
- #ifdef FW_BUILD_WIN
- #define FW_OPENDOC_VERSION FW_OPENDOC_DR2
- #endif
-
- #endif
-
- /*========================================================================================
- / Type definitions
- /========================================================================================*/
-
- #ifndef FW_COMPILER_SUPPORTS_BOOL
- //typedef unsigned char bool;
- #define false 0
- #define true 1
- #endif
-
- typedef unsigned char FW_Boolean;
-
- typedef unsigned short FW_ResourceId;
-
- typedef unsigned short FW_Milliseconds;
-
- typedef unsigned long FW_TypeToken;
-
- // FW_Message is defined in "FWNotDef.h" which may be included by resource files
- // typedef long FW_Message;
-
- // ----- Macintosh -----
- #ifdef FW_BUILD_MAC
-
- typedef char** FW_PlatformHandle;
-
- typedef unsigned long FW_ResourceType;
-
- struct FW_SCodeFragRefFile
- {
- CFragResFileRef fFragRef; // Reference to resource map
- short fRefNum; // RefNum of resource file
- long fNesting; // Nesting level (>0 means in use)
- };
-
- typedef FW_SCodeFragRefFile* FW_Instance;
-
- typedef double_t FW_Double;
-
- typedef Rect FW_SPlatformRect;
- typedef Point FW_SPlatformPoint;
- typedef short FW_PlatformCoordinate;
-
- #endif
-
-
- // ----- Windows -----
- #ifdef FW_BUILD_WIN
-
- typedef HANDLE FW_PlatformHandle;
-
- typedef unsigned short FW_ResourceType;
-
- typedef HINSTANCE FW_Instance;
-
- typedef double FW_Double;
-
- typedef RECT FW_SPlatformRect;
- typedef POINT FW_SPlatformPoint;
-
- #ifdef FW_BUILD_WIN32
- typedef long FW_PlatformCoordinate;
- #endif
- #ifdef FW_BUILD_WIN16
- typedef int FW_PlatformCoordinate;
- #endif
-
- #endif
-
- /*========================================================================================
- / Mac A5 Globals
- /========================================================================================*/
-
- #ifdef FW_BUILD_MAC
-
- #pragma options align=mac68k
- typedef struct
- {
- char privates[76];
- long randSeed;
- BitMap screenBits;
- Cursor arrow;
- Pattern dkGray;
- Pattern ltGray;
- Pattern gray;
- Pattern black;
- Pattern white;
- GrafPtr thePort;
- } FW_QDGlobalRec;
-
- #define FW_QDGlobals (*(FW_QDGlobalRec*)( *(char**)LMGetCurrentA5() \
- - sizeof(FW_QDGlobalRec) + sizeof(GrafPtr)))
-
- #pragma options align=reset
- #endif
-
- /*========================================================================================
- / Constants
- /========================================================================================*/
-
- #ifndef NULL
- #define NULL 0
- #endif
-
- #ifndef FALSE
- #define FALSE 0
- #endif
-
- #ifndef TRUE
- #define TRUE 1
- #endif
-
- /*========================================================================================
- / Macros
- /========================================================================================*/
-
- #define FW_UNUSED(x) ((void) &x)
-
- FW_EXTERN_C_END
-
- //========================================================================================
- // Minimum and maximum functions
- //========================================================================================
-
- #if 0
-
- #define FW_PRIV_DEFINE_MIN_MAX(t) \
- inline t FW_Minimum(t a, t b) \
- { return a < b ? a : b; } \
- inline t FW_Maximum(t a, t b) \
- { return a > b ? a : b; }
-
- #define FW_PRIV_DEFINE_ABS(t) \
- inline t FW_Absolute(t a) \
- { return a < 0 ? -a : a; }
-
- FW_PRIV_DEFINE_MIN_MAX(short)
- FW_PRIV_DEFINE_ABS(short)
-
- FW_PRIV_DEFINE_MIN_MAX(unsigned short)
-
- FW_PRIV_DEFINE_MIN_MAX(int)
- FW_PRIV_DEFINE_ABS(int)
-
- FW_PRIV_DEFINE_MIN_MAX(unsigned int)
-
- FW_PRIV_DEFINE_MIN_MAX(long)
- FW_PRIV_DEFINE_ABS(long)
-
- FW_PRIV_DEFINE_MIN_MAX(unsigned long)
-
- #else
-
- template <class t>
- inline t FW_Minimum(t a, t b) { return a < b ? a : b; }
-
- template <class t>
- inline t FW_Maximum(t a, t b) { return a > b ? a : b; }
-
- template <class t>
- inline t FW_Absolute(t a) { return a < 0 ? -a : a; }
-
- #endif
-
- #endif
-